package cn.internship.modules.manage.service.impl;

import cn.internship.modules.manage.entity.dto.WeeklyRecordSearch;
import cn.internship.modules.manage.entity.vo.WeeklyRecordList;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.internship.common.utils.PageUtils;
import cn.internship.common.utils.Query;

import cn.internship.modules.manage.dao.WeeklyRecordDao;
import cn.internship.modules.manage.entity.WeeklyRecordEntity;
import cn.internship.modules.manage.service.WeeklyRecordService;


@Service("weeklyRecordService")
public class WeeklyRecordServiceImpl extends ServiceImpl<WeeklyRecordDao, WeeklyRecordEntity> implements WeeklyRecordService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<WeeklyRecordEntity> page = this.page(
                new Query<WeeklyRecordEntity>().getPage(params),
                new QueryWrapper<WeeklyRecordEntity>()
        );

        return new PageUtils(page);
    }


    @Override
    public PageUtils listByPage(WeeklyRecordSearch search) {
        Page<WeeklyRecordList> page=new Page<>(search.getPage(),search.getLimit());
        this.baseMapper.queryList(page,search);
        return  new PageUtils(page);
    }

}